//package com.tlkj.common.api.interceptor;
//
//import lombok.RequiredArgsConstructor;
//import org.apache.ibatis.builder.xml.dynamic.DynamicContext;
//import org.apache.ibatis.builder.xml.dynamic.MixedSqlNode;
//import org.apache.ibatis.builder.xml.dynamic.SqlNode;
//import org.apache.ibatis.builder.xml.XMLScriptBuilder;
//import org.apache.ibatis.scripting.xmltags.MixedSqlNode;
//import org.apache.ibatis.scripting.xmltags.SqlNode;
//import org.apache.ibatis.mapping.BoundSql;
//import org.apache.ibatis.mapping.SqlSource;
//import org.apache.ibatis.parsing.XNode;
//import org.apache.ibatis.session.Configuration;
//import org.apache.ibatis.scripting.xmltags.XMLLanguageDriver;
//import org.apache.ibatis.scripting.xmltags.XMLScriptBuilder;
//
//import java.util.Collections;
//
//@RequiredArgsConstructor
//public class DynamicSqlSource implements SqlSource {
//
//    private final Configuration configuration;
//    private final SqlSource sqlSource;
//
//    public DynamicSqlSource(Configuration configuration, String sql) {
//        this.configuration = configuration;
//        XMLLanguageDriver languageDriver = new XMLLanguageDriver();
//        XNode xNode = new XNode(configuration.getParser(), "<script>" + sql + "</script>");
//        XMLScriptBuilder builder = new XMLScriptBuilder(configuration, xNode, null);
//        SqlNode rootSqlNode = builder.parseScriptNode();
//        this.sqlSource = new DynamicSqlSource(configuration, new MixedSqlNode(Collections.singletonList(rootSqlNode)));
//    }
//
//    @Override
//    public BoundSql getBoundSql(Object parameterObject) {
//        return this.sqlSource.getBoundSql(parameterObject);
//    }
//}
